﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Convertor.Interface;

namespace Convertor
{
    /// <summary>
    /// 插件副本（用于保存插件信息和插件子插件）
    /// </summary>
    [Serializable]
    public class SelectedPluginContent : ISelectedPluginContent
    {
        public SelectedPluginContent(string path, object @object)
        {
            this.Path = path;
            var info = @object as IPluginInfo;
            var config = @object as IPluginConfig;
            this.Name = info.Name;
            this.Description = info.Description;
            this.IsSelected = info.IsSelected;
            this.Order = info.Order;
            if (config != null)
            {
                Config = config.Config;
            }
        }

        public override string ToString()
        {
            return this.Name;
        }

        #region IPluginInfo 成员

        public string Name { get; set; }

        public string Description { get; set; }

        public bool IsSelected { get; set; }

        public int Order { get; set; }

        #endregion

        #region IPluginConfig 成员

        public object Config { get; set; }

        #endregion
        
        #region IPluginPath 成员

        public string Path { get; set; }

        #endregion

        #region ISelectedPluginContent 成员

        public List<ISelectedPluginContent> SelectedPlugins { get; set; }

        #endregion
    }
}
